package com.lanou.musicproject.activity;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.ImageView;

import com.lanou.musicproject.R;
import com.lanou.musicproject.adapter.SeekSingerAdapter;
import com.lanou.musicproject.tools.TabLayoutForScrollView;
import com.lanou.musicproject.utils.MyConfig;
import com.squareup.picasso.Picasso;


/**
 * 搜索歌手页面进去之后的页面
 * Created by dllo on 15/10/23.
 */
public class SeekSingerActivity extends AppCompatActivity {
    private TabLayoutForScrollView mTabLayout;
    private ViewPager viewPager;
    private SeekSingerAdapter adapter;
    private ImageView backdrop;
    private String url;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.seeksinger_activity);
        mTabLayout = (TabLayoutForScrollView) findViewById(R.id.seeksinger_tablayout);
        viewPager = (ViewPager) findViewById(R.id.viewPager);
        backdrop = (ImageView) findViewById(R.id.backdrop);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        //在此页面中获得存入缓存中的image值
        String image = MyConfig.getSharePreStr(this, "entity", "url");

        Log.i("--------------***", image);
        Picasso.with(this).load(image).into(backdrop);
        initData();
    }

    private void initData() {
        adapter = new SeekSingerAdapter(getSupportFragmentManager());
        viewPager.setAdapter(adapter);
        mTabLayout.setupWithViewPager(viewPager);
        mTabLayout.setTabsFromPagerAdapter(adapter);

    }

}

